// pages/user/index.js
Page({
  data: {
    userInfo:{},
    collect:[]
  },

  onShow: function () {
    const userInfo = wx.getStorageSync('userInfo');
    const collect = wx.getStorageSync('collect');
    this.setData({
      userInfo,
      collect
    })
  },

  goToUrl(url){
    if(Object.keys(this.data.userInfo).length === 0){
      wx.showToast({
        title: '请您先登陆',
        mask: true,
        icon: "none"
      });
    }else{
      wx.navigateTo({
        url: url
      })
    }
  },

  firstRow0(){
    this.goToUrl("/pages/collect/index?type=0");
  },

  firstRow1(){
    this.goToUrl("/pages/collect/index?type=1");
  },

  firstRow2(){
    this.goToUrl("/pages/collect/index?type=2");
  },

  firstRow3(){
    this.goToUrl("/pages/collect/index?type=3");
  },

  secondGo0(){
    this.goToUrl("/pages/order/index?type=1");
  },


  secondGo1(){
    this.goToUrl("/pages/order/index?type=2");
  },

  secondGo2(){
    this.goToUrl("/pages/order/index?type=3");
  },

  secondGo3(){
    this.goToUrl("/pages/order/index?type=4");
  },

  handleSuggestGo(){
    this.goToUrl("/pages/feedback/index");
  },

  handleAddressGo(){
    this.goToUrl("/pages/address/index");
  },

  toAboutUs(){
    wx.navigateTo({
      url: '/pages/aboutus/index',
    })
  },

  makePhoneCall(e){
    wx.makePhoneCall({
      phoneNumber: '18271955841',
    })
  },
})